package route

import (
	"github.com/gin-gonic/gin"
)

type RouterHandler interface {
	Group(relativePath string, handlers ...gin.HandlerFunc) register
	Use(middleware ...gin.HandlerFunc)
}

type route struct {
	engine *gin.RouterGroup
}

func CreateRouter(engine *gin.RouterGroup) RouterHandler {
	return &route{engine: engine}
}

func (r *route) Group(relativePath string, middleware ...gin.HandlerFunc) register {
	return &route{engine: r.engine.Group(relativePath, middleware...)}
}

func (r *route) Use(middleware ...gin.HandlerFunc) {
	r.engine.Use(middleware...)
}
